import React from 'react'
import {
    BrowserRouter as Router,
    Route,
    Redirect,
    Switch
} from 'react-router-dom'
import { whiteRoutes } from './routes'
import Layout from './views/Layout'

function App() {
    return (
        <Router>
            <Switch>
                {whiteRoutes.map((route) => (
                    <Route
                        path={route.path}
                        component={route.component}
                        key={route.path}
                    />
                ))}
                <Route path="/admin" component={Layout} />
                <Redirect from="/" to="/login" exact />
                <Redirect to="/404" />
            </Switch>
        </Router>
    )
}

export default App
